Determining the Number of Processors
You may want to determine the number of processors available on the host computer before creating any tasks. Typically, you would create one task per processor; even if only one processor is present, it is generally more efficient to assign faceless work to a task and have the cooperatively scheduled main application handle only user interaction.
Multiprocessing Services uses two functions to determine the number of processors. The function MPProcessors
returns the number of physical processors available on the host computer. The function MPProcessorsScheduled
returns the number of active processors available (that is, the number that are currently available to execute tasks). The number of active processors may vary over time (due to changing priorities, power consumption issues, and so on).
© 1999 Apple Computer, Inc. – (Last Updated 17 Nov 99)